﻿using _0016.Gonggong.Models;
using _0016.Tuozhanfangfa;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0016.ViewModels
{
    public class SettingsViewModel:BindableBase
    {
        public SettingsViewModel(IRegionManager regionManager)
        {
            Caidans = new ObservableCollection<Caidans>();
            this.regionManager = regionManager;
            NavigateCommand = new DelegateCommand<Caidans>(Navigate);
            Createcaidan();
        }
        private readonly IRegionManager regionManager;
        private ObservableCollection<Caidans> _caidans;
        public DelegateCommand<Caidans> NavigateCommand{get; private set;}

        private void Navigate(Caidans obj)
        {
            if (obj == null || string.IsNullOrWhiteSpace(obj.Namespace))
            {
                return;
            }
            regionManager.Regions[PrismManager.SettingsViewRegionName].RequestNavigate(obj.Namespace);

        }
        public ObservableCollection<Caidans> Caidans
        {
            get { return _caidans; }
            set { _caidans = value; RaisePropertyChanged(); }
        }

        void Createcaidan()
        {
            Caidans.Add(new Caidans() { Tubiao = "Palette", Title = "个性化", Namespace = "GxhView" });
            Caidans.Add(new Caidans() { Tubiao = "Cog", Title = "系统设置", Namespace = "" });
            Caidans.Add(new Caidans() { Tubiao = "Information", Title = "关于更多", Namespace = "AboutView" });
        }
    }
}
